package com.yanqu.road.server.cmd.chefduel.process2;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.chefduel.ChefDuelProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.chefduel.CrossChefDuelMgr;
import com.yanqu.road.server.protocol.Protocol;

import java.util.List;


@Cmd(code = Protocol.C_CROSS_CHEF_DUEL2_GET_CAN_JOIN_USER, desc = "随便找一个可以加入宴会的人")
public class CrossGetCanJoinCookerCmd extends CrossCommand {

    private long userId;
    private int activityId;
    private long nowUserId;
    private List<Integer> spoonIdList;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ChefDuelProto.CrossChefDuel2CanJoinUserReqMsg reqMsg = ChefDuelProto.CrossChefDuel2CanJoinUserReqMsg.parseFrom(packet.getBytes());
        userId = packet.getPlayerId();
        activityId = reqMsg.getActivityId();
        nowUserId = reqMsg.getHomeUserId();
        spoonIdList = reqMsg.getSpoonIdList();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossChefDuelMgr.getRandomCanJoinUser(activityId,serverId,userId,nowUserId,spoonIdList);
    }

    @Override
    public void sendData() {

    }

}
